<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <link href="../../frame/bootstrap3/css/bootstrap.css" rel="stylesheet" type="text/css"/>
  <script src="../../javascript/jquery-1.9.1.min.js"></script>
  <script src="../../frame/angular/base/angular.js" type="text/javascript"></script>
  <script src="../../frame/bootstrap3/js/bootstrap.min.js"></script>
  <script src="../../js/angular/05-03.js" type="text/javascript"></script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
<button class="btn btn-success" data-toggle="modal" ng-click="showModel()" data-target="#myModal" style="float: right">点我添加用户</button>
<table class="table table-bordered table-hover" id="tb" style="width: 80%;margin-left: 100px;margin-top: 10px">
  <tr>
    <th>序号</th>
    <th>账号</th>
    <th>邮箱</th>
    <th>用户名</th>
    <th>专业</th>
    <th>角色</th>
    <th>操作</th>
  </tr>
  <tr ng-repeat="d in arr">
    <td>{{$index+1}}</td>
    <td>{{d.user_account}}</td>
    <td>{{d.user_email}}</td>
    <td>{{d.user_name}}</td>
    <td>{{d.user_college}}</td>
    <td>{{d.user_role?'老师':'学生'}}</td>
    <td>
      <button type="button" ng-click="showModel(d)" data-toggle="modal" data-target="#myModal" class="btn btn-info btn-sm" title="编辑">
        <span class="glyphicon glyphicon-pencil"></span>
      </button>
      <button type="button" class="btn btn-danger btn-sm" ng-click="delete(d.user_id)" title="删除">
        <span class="glyphicon glyphicon-remove"></span>
      </button>
    </td>
  </tr>
</table>
<!--弹框-->
<div class="modal fade"  id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
          aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel" ng-bind="title"></h4>
      </div>
      <div class="modal-body">
        <form class="form-horizontal">
          <div class="form-group">
            <label for="inputEmail3" class="col-sm-2 control-label">账号</label>
            <div class="col-sm-10">
              <input type="text" ng-model="account" class="form-control" id="account" placeholder="账号">
            </div>
          </div>
          <div class="form-group">
            <label for="inputPassword3" class="col-sm-2 control-label">密码</label>
            <div class="col-sm-10">
              <input type="password" ng-model="pwd" class="form-control" id="userpwd" placeholder="Password">
            </div>
          </div>
          <div class="form-group">
            <label for="inputPassword3" class="col-sm-2 control-label">角色</label>
            <div class="radio">
              <label>
                <input type="radio" ng-model="role" name="optionsRadios" id="admin" value="1">管理员
              </label>
              <label>
                <input type="radio" ng-model="role" name="optionsRadios" id="teacher" value="2">教师
              </label>
            </div>
          </div>
          <div class="form-group">
            <label for="inputPassword3" class="col-sm-2 control-label">姓名</label>
            <div class="col-sm-10">
              <input type="text" ng-model="name" class="form-control" id="username" placeholder="姓名">
            </div>
          </div>
          <div class="form-group">
            <label for="inputEmail3" class="col-sm-2 control-label">Email</label>
            <div class="col-sm-10">
              <input type="text" ng-model="email" class="form-control" id="inputEmail3" placeholder="Email">
            </div>
          </div>
          <div class="form-group">
            <label for="inputEmail3" class="col-sm-2 control-label">所属学校</label>
            <div class="col-sm-10">
              <input type="text" ng-model="school" class="form-control" id="user_college" placeholder="学校">
            </div>
          </div>
          <div class="form-group">
            <label for="inputEmail3" class="col-sm-2 control-label">所授课程</label>
            <div class="col-sm-10">
              <select id="cur" class="form-control" ng-model="cursor">
                <option value="">请选择</option>
                <option value="1">C#</option>
                <option value="2">JAVA</option>
                <option value="3">DBA</option>
                <option value="4">语文</option>
                <option value="5">数学</option>
              </select>
            </div>
          </div>
        </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
        <button type="button" class="btn btn-primary" id="save" ng-click="save()">保存</button>
      </div>
    </div>
  </div>
</div>
</body>
</html>
